%ImageAverage(path)

%path='\\PC0647\d\data\2014\01\17';
path=cd;
numRuns = length(dir('*.h5'));

for I = 2:numRuns
    %rawimages = cast(h5read(,'/Image/image'),'double')/4;  %recasting from 2^14 to 2^16 bits
    varinfo=h5info([path '\run_' num2str(I-1) '.h5'],'/VariableValues/');
    datasets=varinfo.Datasets;
    nsets=length(datasets);
    finalnames={};
    finalvars=[];
    for i=1:nsets
        inivec=datasets(i).Name;
        target=strcat('/VariableValues/',inivec);
        targetvar=h5read(fid,char(target));
        if isa(targetvar,'double')==1
            finalnames=[finalnames,inivec];
            variab=h5read(fid,char(target));
            finalvars=[finalvars,variab];
        end
    end
    finalnames;
    finalvars;
end


